# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.NetworkServices.V1.Model.HttpRouteStatefulSessionAffinityPolicy do
  @moduledoc """
  The specification for cookie-based stateful session affinity where the date plane supplies a “session cookie” with the name "GSSA" which encodes a specific destination host and each request containing that cookie will be directed to that host as long as the destination host remains up and healthy. The gRPC proxyless mesh library or sidecar proxy will manage the session cookie but the client application code is responsible for copying the cookie from each RPC in the session to the next.

  ## Attributes

  *   `cookieTtl` (*type:* `String.t`, *default:* `nil`) - Required. The cookie TTL value for the Set-Cookie header generated by the data plane. The lifetime of the cookie may be set to a value from 0 to 86400 seconds (24 hours) inclusive. Set this to 0s to use a session cookie and disable cookie expiration.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :cookieTtl => String.t() | nil
        }

  field(:cookieTtl)
end

defimpl Poison.Decoder,
  for: GoogleApi.NetworkServices.V1.Model.HttpRouteStatefulSessionAffinityPolicy do
  def decode(value, options) do
    GoogleApi.NetworkServices.V1.Model.HttpRouteStatefulSessionAffinityPolicy.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.NetworkServices.V1.Model.HttpRouteStatefulSessionAffinityPolicy do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
